const schedule = require("node-schedule");
const { log } = require("./utils");
const updateLink = require("../task/updateHouseLinks");
const updateDetail = require("../task/updateHouseDetail");
class Schedule {

	init() {
		this.runHouseTask();
		log("blue", "Task 初始化完成!");
	}
	runHouseTask() {
		// updateLink(1, 3, "ca");
		// updateDetail("ca");
		schedule.scheduleJob("0 10 1 * * *", () => {
			updateLink(1, 3, "c6");
		});
		schedule.scheduleJob("0 20 1 * * *", () => {
			updateLink(1, 3, "ca");
		});
		schedule.scheduleJob("0 30 1 * * *", () => {
			updateDetail("c6");
		});
		schedule.scheduleJob("0 40 1 * * *", () => {
			updateDetail("ca");
		});
	}
}

module.exports = new Schedule();